﻿using Api_Core_Spider.Models;

namespace Api_Core_Spider.Services
{
    /// <summary>
    /// 激活服务接口，定义软件激活相关操作
    /// </summary>
    public interface IActivationService
    {
        /// <summary>
        /// 处理激活请求
        /// </summary>
        /// <param name="request">激活请求</param>
        /// <returns>激活响应</returns>
        ActivationResponse Activate(ActivationRequest request);

        /// <summary>
        /// 验证激活码
        /// </summary>
        /// <param name="request">验证请求</param>
        /// <returns>验证响应</returns>
        ValidationResponse Validate(ValidationRequest request);

        /// <summary>
        /// 生成产品密钥
        /// </summary>
        /// <param name="productId">产品ID</param>
        /// <param name="userId">用户ID</param>
        /// <param name="days">有效期天数</param>
        /// <returns>产品密钥</returns>
        string GenerateProductKey(string productId, string userId, int days);

        /// <summary>
        /// 生成激活码
        /// </summary>
        /// <param name="machineCode">机器码</param>
        /// <param name="productKey">产品密钥</param>
        /// <returns>激活码</returns>
        string GenerateActivationCode(string machineCode, string productKey);
        /// <summary>
        /// 检查产品密钥是否有效
        /// </summary>
        bool IsValidProductKey(string productKey);
        /// <summary>
        /// 检查机器码是否已激活
        /// </summary>
        /// <param name="machineInfo"></param>
        /// <returns></returns>
        bool IsActivated(MachineInfo machineInfo); 
    }
}